library(rstudioapi)
library(xlsx)
setwd(file.path(rstudioapi::getActiveProject(), "features"))
rm(list = ls(all.names = TRUE))
source("features_choice_change.R")
rm(list = ls(all.names = TRUE))
source("features_obsct.R")
rm(list = ls(all.names = TRUE))
source("features_pcmplt.R")
rm(list = ls(all.names = TRUE))
source("features_probcorrect.R")
rm(list = ls(all.names = TRUE))
source("features_probswitch.R")
rm(list = ls(all.names = TRUE))
source("features_response_time.R")
rm(list = ls(all.names = TRUE))
source("features_combined.R")

setwd(file.path(rstudioapi::getActiveProject(), "model"))
rm(list = ls(all.names = TRUE))
source("train_model.R")
rm(list = ls(all.names = TRUE))
source("predict.R")




# 创建一个包含 STUDENTID 和预测类别的新数据框
combined_df <- data.frame(STUDENTID = testBlockB$STUDENTID,  PredictedProbTrue = predictions_prob[["RRF"]][, "TRUE."],PredictedProbFalse = predictions_prob[["RRF"]][, "FALSE."])

# 将数据框写入 Excel 文件
write.xlsx(combined_df, "../output.xlsx")

